Method and device for encoding and decoding image

ABSTRACT

A method for decoding an image according to the present invention comprises the steps of: restoring a residual block by performing inverse quantization and inverse transformation for the entropy-decoded residual block; generating a prediction block by performing intra prediction for a current block; and restoring an image by adding the restored residual block to the prediction block, wherein the step of generating the prediction block further comprises a step for generating a final prediction value of a pixel to be predicted, on the basis of a first prediction value of the pixel to be predicted, which is included in the current block, and of a final correction value that is calculated by performing an arithmetic right shift by a binary digit I for a two&#39;s complement integer representation with respect to an initial correction value of the pixel to be predicted. The operational complexity during image encoding/decoding can be reduced.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of Application No. 14/372,278 having a 371(c) date of Jul. 15, 2014, which is a national stage application of International Application No. PCT/KR2013/000417 filed on Jan. 18, 2013, which claims the benefit of Korean Application No. 10-2012-0005950 filed on Jan. 18, 2012, and Korean Application No. 10-2013-0005653 filed on Jan. 18, 2013, in the Korean Intellectual Property Office, the entire disclosures of which are incorporated herein by reference for all purposes.

TECHNICAL FIELD

The present invention concerns a method and apparatus for encoding and decoding an images, and more specifically, to an intra prediction and inter prediction method by reducing computation complexity.

BACKGROUND ART

Recent spread of HD (High Definition) broadcast services nationwide and worldwide makes more users familiar with high-resolution, high-quality images, and many organizations put more efforts to development of next-generation imaging devices. Further, more interest is oriented towards UHD (Ultra High Definition) having 4 times or more resolution than HDTV, as well as HDTV, so that image compression technologies for higher-resolution, higher-quality images are demanded.

For purposes of image compression, an inter prediction for predicting a pixel value included in a current picture from a temporally previous and/or subsequent picture, an intra prediction for predicting a pixel value included in a current picture by using pixel information in the current picture, and an entropy encoding for assigning a shorter code to a more frequent symbol while assigning a longer code to a less frequent symbol may be used.

DISCLOSURE Technical Problem

An object of the present invention is to provide an image encoding method and apparatus that may enhance image encoding/decoding efficiency by reducing computation complexity.

Another object of the present invention is to provide an image decoding method and apparatus that may enhance image encoding/decoding efficiency by reducing computation complexity.

Still another object of the present invention is to provide a prediction block generating method and apparatus that may enhance image encoding/decoding efficiency by reducing computation complexity.

Yet still another object of the present invention is to provide an intra prediction method and apparatus that may enhance image encoding/decoding efficiency by reducing computation complexity.

Yet still another object of the present invention is to provide an inter prediction method and apparatus that may enhance image encoding/decoding efficiency by reducing computation complexity.

Technical Solution

To achieve the above objects, an image decoding method according to the present invention includes the steps of reconstructing a residual block by inverse-quantizing and inverse-transforming an entropy-decoded residual block, generating a prediction block by performing intra prediction on a current block, and reconstructing an picture by adding the reconstructed residual block to the prediction block, the step of generating the prediction block includes the step of generating a final prediction value of a prediction target pixel included in the current block based on a first prediction value of the prediction target pixel and a final correction value calculated by performing an arithmetic right shift on a two's complementary integer representation for an initial correction value of the prediction target pixel by a binary digit of 1.

The step of generating the prediction block may include the steps of determining whether to correct an intra prediction value depending on encoding information of the current block and a position of the prediction target pixel in the current block and generating a final prediction value of the prediction target pixel based on a result of the determination.

The step of determining whether to correct may include the step of determining whether to correct the intra prediction value considering at least one of an intra prediction mode of the current block, luma signal information, chroma signal information, and a block size.

The step of determining whether to correct may include the step of determining that, in a case where an intra prediction mode of the current block is a vertical direction prediction mode, correction may be performed on a pixel positioned at a left boundary in the current block.

The step of determining whether to correct may include the step of determining that, in a case where an intra prediction mode of the current block is a horizontal direction prediction mode, correction may be performed on a pixel positioned at an upper boundary in the current block.

The step of generating the final prediction value may include, in a case where correction is determined to be performed on an intra prediction value, the steps of obtaining a first prediction value using a value of a reference pixel adjacent to the current block, determining an initial correction value depending on a horizontal or vertical position of the prediction target pixel in the block, calculating a final correction value by performing an arithmetic right shift on the two's complementary integer representation for the initial correction value by a binary digit of 1, and calculating the final prediction value based on the first prediction value and the final correction value.

In a case where the intra prediction mode is a vertical direction prediction mode, correction may be performed on a pixel positioned at a left boundary of the current block, the first prediction value may be generated using a value of an upper reference pixel adjacent to the current block, the initial correction value may be determined using a difference between a value of a left reference pixel corresponding to a vertical position of the prediction target pixel in the block and a value of a left and upper cornered reference pixel adjacent to the current block, and in a case where the intra prediction mode is a horizontal direction prediction mode, correction may be performed on a pixel positioned at an upper boundary of the current block, the first prediction value may be generated using a value of a left reference pixel adjacent to the current block, the initial correction value may be determined using a difference between a value of an upper reference pixel corresponding to a horizontal position of the prediction target pixel in the block and a value of a left and upper cornered pixel of the current block.

The step of generating the final prediction value may include, in a case were no correction is determined to be performed on the intra prediction value, the steps of generating a final prediction value of the prediction target pixel based on a value of an upper reference pixel adjacent to the current block in a vertical direction prediction mode, and generating a final prediction value of the prediction target pixel based on an value of an upper reference pixel adjacent to the current block in a horizontal direction prediction mode.

The image decoding method further may include the step of determining a reference pixel to be used for performing intra prediction on the prediction target pixel, the step of determining the reference pixel may include the steps of determining a reference pixel using an already reconstructed pixel among pixels adjacent to the current block and performing smoothing filtering on a pixel value of the reference pixel.

To achieve the above-described objects, an image decoding apparatus according to the present invention may include a residual block reconstructing unit that reconstructs a residual block by inverse-quantizing and inverse-transforming an entropy-decoded residual block, a prediction block generating unit that generates a prediction block by performing intra prediction on a current block, and an picture reconstructing unit that reconstructs an picture by adding the residual block to the prediction block, the prediction block generating unit generates a final prediction value of a prediction target pixel included in the current block based on a first prediction value of the prediction target pixel and a final correction value calculated by performing an arithmetic right shift on a two's complementary integer representation for an initial correction value of the prediction target pixel by a binary digit of 1.

To achieve the above-described objects, an image encoding method according to the present invention may include the steps of generating a prediction block by performing intra prediction on an input image and performing entropy encoding by transforming and quantizing a residual block that is a difference between a prediction block predicted by intra prediction and a current prediction block, the step of generating the prediction block may include the step of generating a final prediction value of a prediction target pixel included in the current block based on a first prediction value of the prediction target pixel and a final correction value calculated by performing an arithmetic right shift on a two's complementary integer representation for an initial correction value of the prediction target pixel by a binary digit of 1.

To achieve the above-described objects, an image encoding apparatus according to the present invention may include a prediction block generating unit that generates a prediction block by performing intra prediction on an input image and an encoding unit that performs entropy encoding by transforming and quantizing a residual block that is a difference between a prediction block predicted by intra prediction and a current prediction block, the step of generating the prediction block may include the step of generating a final prediction value of a prediction target pixel included in the current block based on a first prediction value of the prediction target pixel and a final correction value calculated by performing an arithmetic right shift on a two's complementary integer representation for an initial correction value of the prediction target pixel by a binary digit of 1.

To achieve the above-described objects, an image decoding method according to the present invention may include the steps of reconstructing a residual block by inverse-quantizing and inverse-transforming an entropy-decoded residual block, generating a prediction block by performing intra prediction on a current block, and reconstructing an picture by adding the reconstructed residual block to the prediction block, the step of generating the prediction block may include the steps of determining whether a reference picture of the current block is the same as a reference picture of the reference block and in a case where it is determined that the reference picture of the current block is not the same as the reference picture of the reference block, scaling a motion vector of the reference block and using the scaled motion vector for prediction of the current block.

Upon inducing a spatial or temporal motion vector and upon inducing a temporal merge candidate, the used reference block may include i) upon inducing the spatial motion vector, at least one of a lowermost block adjacent to a left side of the current block, a block adjacent to a lower side of the left and lowermost block, a left and upper cornered block of the current block, a right and upper cornered block of the current block, and an upper and rightmost block adjacent to the current block, and ii) upon inducing the temporal motion vector and iii) upon inducing the temporal merge candidate, at least one of blocks positioned in and outside a co-located block spatially corresponding to the current block in a co-located picture of a current picture.

The step of generating the prediction block may include the steps of obtaining first and second values based on a POC (Picture Order Count) difference between the pictures, calculating an inverse-proportional value of the first value by calculating an offset value by performing an arithmetic right shift on a two's complementary integer representation for an absolute value of the first value by a binary digit of 1, and calculating the scaling factor based on the inverse-proportional value of the first value and the second value.

i) upon inducing the spatial motion vector, the first value may be a difference between a POC of a current picture and a POC of a reference picture referred to by the reference block, and the second value may be a difference between a POC of the current picture and a POC of a reference picture referred to by the current block, and ii) upon inducing the temporal motion vector or iii) upon inducing the temporal merge candidate, the first value may be a difference between a POC of a co-located picture and a POC of a reference picture referred to by a co-located block and the current block in the co-located picture, and the second value may be a difference between a POC of a current block picture and a POC of a reference picture referred to by the current block.

The step of calculating the scaling factor may include the steps of calculating the scaling factor by performing an addition operation and an arithmetic right shift operation based on multiplication of the inverse-proportional value of the first value and the second value and adjusting the scaling factor to be included in a specific range.

To achieve the above-described objects, an image decoding apparatus according to the present invention may include a residual block reconstructing unit that reconstructs a residual block by inverse-quantizing and inverse-transforming an entropy-decoded residual block, a prediction block generating unit that generates a prediction block by performing intra prediction on a current block, and an picture reconstructing unit that reconstructs an picture by adding the reconstructed residual block to the prediction block, the prediction block generating unit may include a sameness determining unit that determines whether a reference picture of the current block is the same as a reference picture of the reference block and a scaling unit that, in a case where the reference of the current block is not the same as the reference picture of the reference block, scales a motion vector of the reference block and uses the scaled motion vector for prediction of the current block.

To achieve the above-described objects, an image encoding method according to the present invention may include the steps of generating a prediction block by performing intra prediction on an input image and performing entropy encoding by transforming and quantizing a residual block that is a difference between the current input block and a prediction block predicted by intra prediction, the step of generating the prediction block may include the steps of determining whether a reference picture of the current block is the same as a reference picture of the reference block and in a case where the reference of the current block is not the same as the reference picture of the reference block, scaling a motion vector of the reference block and using the scaled motion vector for prediction of the current block.

To achieve the above-described objects, an image encoding apparatus according to the present invention may include a prediction block generating unit that generates a prediction block by performing intra prediction on an input image and an encoding unit that performs entropy encoding by transforming and quantizing a residual block that is a difference between the current input block and a prediction block predicted by intra prediction, the prediction block generating unit may include a sameness determining unit that determines whether a reference picture of the current block is the same as a reference picture of the reference block and a scaling unit that, in a case where the reference of the current block is not the same as the reference picture of the reference block, scales a motion vector of the reference block and uses the scaled motion vector for prediction of the current block.

Advantageous Effects

The image encoding method according to the present invention may reduce computation complexity and enhance image encoding/decoding efficiency.

The image decoding method according to the present invention may reduce computation complexity and enhance image encoding/decoding efficiency.

The prediction block generating method according to the present invention may reduce computation complexity and enhance image encoding/decoding efficiency.

The intra prediction method according to the present invention may reduce computation complexity and enhance image encoding/decoding efficiency.

The inter prediction method according to the present invention may reduce computation complexity and enhance image encoding/decoding efficiency.

DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating a configuration of an image encoding apparatus according to an embodiment of the present invention.

FIG. 2 is a block diagram illustrating a configuration of an image decoding apparatus according to an embodiment of the present invention.

FIG. 3 is a flowchart illustrating a process of producing a final prediction value of a current block in an image encoding/decoding method according to an embodiment of the present invention.

FIG. 4 is a flowchart schematically illustrating a process of yielding a reference pixel to be used for intra prediction according to an embodiment of the present invention.

FIG. 5 is a view schematically illustrating the replacement of an unavailable pixel in a process of yielding a reference picture to be used for intra prediction according to an embodiment of the present invention.

FIG. 6 is a flowchart schematically illustrating a process of determining whether to correct an intra prediction value depending on the position of a prediction target pixel and encoding information of a current block.

FIG. 7a is a view schematically illustrating an embodiment in which in a vertical prediction mode a first prediction value for a pixel in a current block is used as a final prediction value.

FIG. 7b is a view schematically illustrating an embodiment in which in a horizontal prediction mode a first prediction value for a pixel in the current block is used as the final prediction value.

FIG. 8 is a flowchart schematically illustrating an embodiment in which correction is performed on a first prediction value for a pixel in a current block to yield a final prediction value.

FIG. 9a is a view schematically illustrating an embodiment for producing a final prediction value by performing correction on a first prediction value when using a vertical mode.

FIG. 9b is a view schematically illustrating an embodiment for producing a final prediction value by performing correction on a first prediction value when using a horizontal mode.

FIG. 10 is a flowchart schematically illustrating a process of performing scaling in an image encoding/decoding method according to another embodiment of the present invention.

FIG. 11a is a view illustrating a POC difference between a current picture and a current picture of a spatial reference block and a POC difference between the current picture and a reference picture of the current block.

FIG. 11b is a view illustrating a POC difference between a reference picture of a co-located block and a co-located picture and a POC difference between a current picture and a reference picture of a current block.

FIG. 12 is a flowchart schematically illustrating an embodiment of a process of calculating a scaling factor for a motion vector based on POC differences between pictures.

FIG. 13 is a block diagram schematically illustrating a configuration of calculating a final scaling factor based on tb and an inverse-proportional value of td.

BEST MODE

Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. In describing the embodiments, when determined to make the gist of the invention unclear, the detailed description on the well-known configurations or functions will be omitted.

When a component is “connected to” or “coupled to” another component, the component may be directly connected or coupled to the other component, or other components may also intervene. Further, when a specific component is “included”, other components are not excluded but may be included, and such configuration is also included in the scope of the invention.

The terms “first” and “second” may be used to describe various components, but the components are not limited thereto. These terms are used only to distinguish one component from another. For example, the first component may be also named the second component, and the second component may be similarly named the first component.

The constitutional parts in the embodiments are independently shown to represent different features, but this does not mean that each constitutional part is formed of a separate hardware unit or one software constitutional unit. That is, each constitutional part is separated from the others for ease of description. At least two of the constitutional parts may be combined into a single constitutional part, or one constitutional part may be divided into a plurality of constitutional parts which may perform functions, respectively. The embodiments covering the combinations of the constitutional parts or the separation thereof may be included in the scope of the invention without departing from the gist of the invention.

Some constitutional parts are not essential ones to perform the inevitable functions of the present invention but rather may be optional constitutional parts to enhance performance. The present invention may be implemented only by the constitutional parts necessary for realizing the gist of the invention or such a configuration that includes only the essential constitutional parts excluding the optional constitutional parts used for enhancing performance may also be included in the scope of the present invention.

FIG. 1 is a block diagram illustrating a configuration of an image encoding apparatus according to an embodiment of the present invention.

Referring to FIG. 1, the multi-view video image decoding apparatus 100 includes a motion prediction unit 111, a motion compensation unit 112, an intra prediction unit 120, a switch 115, a subtractor 125, a transform unit 130, a quantization unit 140, an entropy encoding unit 150, an inverse quantization unit 160, an inverse transform unit 170, an adder 175, a filter unit 180, and a reference image buffer 190. Here, the term “image” may be used to have the same meaning as the term “picture” to be described below.

The image encoding apparatus 100 may perform encoding on an input image in an intra mode or inter mode and may output a bit stream. The intra prediction means intra-screen prediction, and the inter prediction means inter-screen prediction. In the intra mode, the switch 115 may shift to intra, and in the inter mode, the switch 115 may shift to inter. The image encoding apparatus 100 may generate a prediction block on an input block of the input image and may then encoding a differential between the input block and the prediction block.

In the intra mode, the intra prediction unit 120 may generate a prediction block by performing spatial prediction using a pixel value of an already encoded block adjacent to a current block.

In the inter mode, the motion prediction unit 111 may obtain a motion vector by figuring out an area that best matches an input block of a reference image stored in the reference image buffer 190 during the course of motion prediction. The motion compensation unit 112 may generate a prediction block by performing motion compensation using a motion vector. Here, the motion vector is a 2D (two-dimensional) vector used for inter prediction, and may represent an offset between a current encoding/decoding target image and a reference image.

The subtractor 125 may generate a residual block based on a differential between an input block and a generated prediction block. The transform unit 130 may perform transform on a residual block to output a transform coefficient. The quantization unit 140 may perform quantization on an input transform coefficient based on a quantization parameter to output a quantized coefficient.

The entropy encoding unit 150 may perform entropy encoding based on a encoding parameter value produced during the course of encoding or values produced by the quantization unit 140 to thereby output a bit stream.

When entropy encoding applies, a fewer number of bits are assigned to a symbol having a higher probability of occurrence, while a more number of bits are assigned to a symbol having a lower probability of occurrence, so that the size of the bit stream for the encoding target symbols may be reduced. Accordingly, the compression performance of image encoding may be increased through entropy encoding. The entropy encoding unit 150 may adopt encoding schemes, such as exponential golomb, CAVLC(Context-Adaptive Variable Length Coding), CABAC(Context-Adaptive Binary Arithmetic Coding), for purposes of entropy encoding.

Since the image encoding apparatus shown in FIG. 1 conducts inter prediction encoding, i.e., inter-frame prediction encoding, a currently encoded image needs to be decoded and then stored to be used as a reference image. Accordingly, a quantized coefficient is inverse-quantized in the inverse quantization unit 160, and inverse-transformed in the inverse transform unit 170. An inverse-quantized, inverse-transformed coefficient is added to a prediction block through the adder 175, thereby producing a reconstructed block.

The reconstructed block passes through the filter unit 180 that may apply at least one or more of a deblocking filter, SAO (Sample Adaptive Offset), and ALF (Adaptive Loop Filter) to a reconstructed block or reconstructed picture. The filter unit 180 may be also called an adaptive in-loop filter. The deblocking filter may remove a distortion that occurs at a boundary between blocks. The SAO may add a proper offset value to a pixel value so as to compensate for a coding error. The ALF may perform filtering based on a value obtained by comparing a reconstructed image with an original image. A reconstructed block which has passed through the filter unit 180 may be stored in the reference image buffer 190.

FIG. 2 is a block diagram illustrating a configuration of an image decoding apparatus according to an embodiment of the present invention.

Referring to FIG. 2, the image decoding apparatus 200 includes an entropy decoding unit 210, an inverse-quantization unit 220, an inverse-transform unit 230, an intra prediction unit 240, a motion compensation unit 250, an adder 255, a filter unit 260, and a reference picture buffer 270.

The image decoding apparatus 200 may receive a bit stream output from an encoder, perform decoding in an intra mode or inter mode, and output a reconstructed image, i.e., a reconstructed image. In the intra mode, the switch may shift to intra, and in the inter mode, the switch may shift to inter. The image decoding apparatus 200 may obtain a reconstructed residual block from a received bit stream, generate a prediction block, and add the reconstructed residual block to the prediction block to thereby generate a reconstructed block, i.e., a reconstructed block.

The entropy decoding unit 210 may entropy-decode an input bit stream according to a probability distribution to thereby generate symbols including quantized coefficient types of symbols. Entropy decoding schemes are similar to the above-described entropy encoding schemes.

When an entropy decoding scheme applies, a less number of bits are assigned to a symbol having a higher probability of occurrence, with a more number of bits assigned to a symbol having a lower probability of occurrence, so that the size of the bit stream for each symbol may be reduced. Accordingly, compression performance of image decoding may be increased through the entropy decoding scheme.

A quantized coefficient may be inverse-quantized in the inverse-quantization unit 220, and inverse-transformed in the inverse-transform unit 230. As a result of inverse quantization/inverse transform of the quantized coefficient, a reconstructed residual block may be generated.

In the intra mode, the intra prediction unit 240 may generate a prediction block by performing spatial prediction using a pixel value of an already encoded/decoded block adjacent to a current block. In the inter mode, the motion compensation unit 250 may generate a prediction block by performing motion compensation using a reference image stored in the reference picture buffer 270 and a motion vector.

The reconstructed residual block and prediction block are added to each other through the adder 255, and the resultant block may go through the filter unit 260. The filter unit 260 may apply at least one or more of a deblocking filter, SAO, and ALF to a reconstructed block or a reconstructed picture. The filter unit 260 may output a reconstructed image, i.e., a reconstructed image. The reconstructed image may be stored in the reference picture buffer 270 and may be used for inter prediction.

Hereinafter, the “unit” means a basis on which image encoding and decoding are carried out. Upon image encoding and decoding, a unit for encoding or decoding is the one split from an image for purposes of encoding or decoding, and thus, the unit may be also referred to as a block, a coding unit (CU), a prediction unit (PU), a transform unit (TU), etc. Further, the unit may be also denoted as a block in some embodiments to be described below. One unit may be further split into sub units having a smaller size. Further, the “current block” used herein may refer to a block that is targeted for intra prediction or motion compensation. In case intra prediction is performed, the current block may mean any one of a prediction unit, a prediction block, a transform unit, and a transform block, and in case motion compensation is performed, the current block may mean one of a prediction unit and a prediction block.

FIG. 3 is a flowchart illustrating a process of producing a final prediction value of a current block in an image encoding/decoding method according to an embodiment of the present invention.

Referring to FIG. 3, an image encoding/decoding apparatus according to an embodiment of the present invention produces a final prediction value based on a reference pixel to generate a prediction block for a current block. For this purposes, the image encoding/decoding apparatus obtains a pixel value of a reference pixel to be used for intra prediction (S310). An already reconstructed pixel of pixels adjacent to the current block may be used as the reference pixel. if the adjacent pixels are unavailable, the pixel values of the unavailable pixels may be replaced with the value of the corresponding reference pixel. After the reference pixel is obtained, encoding information of the current block and in-block position information of a prediction target pixel are obtained (S320). Then, it is determined whether it is needed to correct a first prediction value through the reference pixel value based on the encoding information and the in-block position information of the prediction target pixel (S330). At this time, the determination may be changed based on at least one of intra (intra-frame) prediction mode information, brightness signal information, color difference signal information and block size.

In case it is determined that no correction is needed, the image encoding/decoding apparatus may directly utilize the first prediction value as the final prediction value of the current block (S340). On the contrary, if a correction is determined to be required, the image encoding/decoding apparatus may first obtain the first prediction value and a corrected value and may add the first prediction value to the corrected value to thereby yield a final prediction value (S350). At this time, the complexity of computation associated with the calculation of the corrected value is generally very high, so that it may be considered for purposes of reducing such complexity to conduct an arithmetic right shift operation. The arithmetic right shift operation (“>>”) has the characteristic that the sign of a value targeted for the operation does not vary, and in contrast to the common integer dividing operation (“/”) which renders a result rounded to be close to 0, leaves a result rounded to reach negative infinity.

FIG. 4 is a flowchart schematically illustrating a process of yielding a reference pixel to be used for intra prediction according to an embodiment of the present invention.

Referring to FIG. 4, an encoding/decoding apparatus determines whether a pixel value of an adjacent block may be used based on pixel information of an adjacent block of a current block (S410). At this time, when no pixel value of the adjacent block may be used may be one of i) when the pixel of the adjacent block is outside a picture boundary, ii) when the pixel of the adjacent block is outside a slice/tile boundary, and iii) when CIP (constrained_intra_pred_flag) is 1—that is, when the current block is a CIP-applied block and the adjacent block is a block encoded by inter prediction. As such, in case the pixel value of the adjacent block may not be used as a reference pixel value, the corresponding reference pixel value may be replaced with an available pixel value of another adjacent block or a specific default (S420).

FIG. 5 is a view schematically illustrating the replacement of an unavailable pixel in a process of yielding a reference picture to be used for intra prediction according to an embodiment of the present invention.

Referring to FIG. 5, adjacent blocks of a current block 500 may be used to obtain a reference pixel value. At this time, as adjacent blocks to be used for obtaining a reference pixel value, there may be an adjacent block adjacent to the current block 500, an adjacent block adjacent to a lower side of a left and lowermost adjacent block by the height of the current block 500, and an adjacent block adjacent to a right side of a top and rightmost adjacent block by the width of the current block 500. At this time, among pixels of the adjacent blocks, only pixels positioned adjacent to the current block 500 may be used as the reference pixel.

At this time, in case the adjacent blocks may not be used to obtain the reference pixel value, it may be replaced with an available pixel value of another adjacent block. In FIG. 5, among the adjacent blocks of the current block 500, hatched ones are available blocks, and the others are unavailable blocks.

According to an embodiment of the present invention, the image encoding/decoding apparatus may determine whether a pixel positioned adjacent to the current block 500 is available, and may store a result of the determination. For example, the apparatus may determine that, in FIG. 5, pixels in the hatched blocks are available ones and pixels in the non-hatched blocks are unavailable and may store a result. At this time, in case one or more unavailable pixels are present, the unavailable pixel values may be replaced with an available pixel value.

Shifting from a pixel 520 at position A as a start point to a pixel 522 at position B, an unavailable pixel may be replaced with an available pixel value that comes right before the unavailable pixel. At this time, in case the pixel 520 at the start point is unavailable, the pixel value of an available pixel 512 that comes first when shifting from position A to position B may be replaced with the pixel 520 value of the start point. Among the adjacent blocks 510, 530, and 532, the adjacent block 510 is available, and the adjacent blocks 530 and 532 are unavailable. Accordingly, the pixel 520 at the start point is an unavailable pixel. The pixel 520 at the start point may be replaced with the pixel value of an available pixel 512 that first comes as goes from position A to position B, a pixel of the adjacent block 530 may be replaced with the pixel value of the pixel 512, and a pixel of the adjacent block 532 may be replaced with the pixel value of a pixel 514 that is an available pixel coming right before it. In such way, unavailable pixels may be replaced with available pixels until reaching position B.

Turning back to FIG. 4, in case a result of determining whether adjacent block pixels are available shows that the pixel value of an adjacent block is available, the pixel value of the adjacent block may be, as is, used as the reference pixel value (S422).

The image encoding/decoding apparatus may perform smoothing filtering on an obtained reference pixel value (S430). At this time, the smoothing filtering may be conducted in a different way according to the size of a target block and/or intra prediction mode.

FIG. 6 is a flowchart schematically illustrating a process of determining whether to correct an intra prediction value depending on the position of a prediction target pixel and encoding information of a current block.

Referring to FIG. 6, the image encoding/decoding apparatus may determine whether to perform correction based on an in-block position of a prediction target pixel and current block encoding information. The encoding information used for determining whether to perform correction may include any one of intra prediction mode information, brightness signal information, color difference signal information, and block size, as described above.

In order to determine whether to perform correction, the image encoding/decoding apparatus first determines whether an intra prediction mode of a current block is a vertical prediction mode (S610). In the vertical prediction mode, it is determined whether the prediction target pixel is a pixel positioned at a left boundary of the current block (S612). If it is determined as a pixel positioned at the left boundary, correction is determined to be performed (S632). In case the intra prediction mode is the vertical prediction mode but the pixel is not positioned at the left boundary, no correction may be performed (S630). Determination on the vertical prediction mode and horizontal prediction mode may be conducted with reference to what is to be described below. In determining the horizontal prediction mode, it may be strictly determined whether the prediction direction is exactly the horizontal direction, but further eased conditions may apply to determine whether the prediction direction is close to the horizontal direction. As an example of horizontal prediction mode determination using mitigated conditions, if upon horizontal prediction mode determination, the prediction direction of the target prediction mode is within 30 degrees of the horizontal direction, it may be determined as the horizontal prediction mode. At this time, the degree, as a reference of the determination, is not necessarily limited to 30 degrees, and other angles may be also used as the reference. Also in determining the vertical prediction mode, as in determining the horizontal prediction mode, more smooth conditions may be used to determine whether the prediction direction is close to the vertical direction or not. Although in the subsequent embodiments it is strictly determined whether the prediction direction is the horizontal and vertical directions, the present invention is not limited thereto, and examples where determination on the horizontal and/or vertical directions is made based on the mitigated conditions as described above also belong to the scope of the present invention.

Then, whether it is a horizontal prediction mode is determined (S620). The steps of determining the vertical prediction mode and horizontal prediction mode (S610 and S620) are not essentially associated with each other, and the order of performing the steps S610 and S620 may be changed. In the case of the horizontal prediction mode, it is determined whether the prediction target pixel is a pixel positioned at an upper boundary of a current block (S622). If it is determined that the prediction target pixel is a pixel positioned at the upper boundary, correction is determined to be performed (S632). In case the intra prediction mode is a horizontal prediction mode but the pixel is not positioned at the upper boundary, no correction may be performed (S630). In case the intra prediction mode is not a vertical or horizontal prediction mode, no correction on a prediction value for a current block may be conducted (S630).

According to an embodiment of the present invention, correction on the prediction value for the current block may be done in consideration of at least one of the intra prediction mode and block size as described above only with respect to the brightness (luma) signal, but not with respect to the color difference (chroma) signal.

According to another embodiment of the present invention, prediction value correction may be conducted on a block having a size of 32×32 or less. In other words, prediction value correction may be performed on a block having a size of 4×4, 8×8, and 16×16.

According to still another embodiment of the present invention, in case the inter prediction mode is a DC mode, correction may be done on pixels positioned at the top and left boundaries of a current block.

FIG. 7a is a view schematically illustrating an embodiment in which in a vertical prediction mode a first prediction value for a pixel in a current block is used as a final prediction value, and FIG. 7b is a view schematically illustrating an embodiment in which in a horizontal prediction mode a first prediction value for a pixel in the current block is used as the final prediction value.

Referring to FIGS. 7a and 7 b, the image encoding/decoding apparatus obtains a first prediction value and then determines, without correction, the first prediction value as a final prediction value for the current block 710 when it is determined in the step S330 that no correction is to be performed on the prediction value depending on at least one of intra prediction mode, brightness signal, color difference signal information and block size.

At this time, the first prediction value (pred[x,y]) may be obtained based on a reference pixel value. p[x,y] to be described below means the reference pixel value at position [x,y]. Thereafter, in an embodiment, x=−1, . . . , BlockWidth−1, y=−1, . . . , BlockHeight−1. Here, BlockWidth refers to the width of a current block, and BlockHeight refers to the height of a current block. In the embodiments described in connection with FIGS. 7a and 7 b, a 4×4 block is described as an example, and in such case, the reference pixel may have a range of x=−1, . . . , 3 and y=−1, . . . , 3, and the pixel of the current block may have a range of x=0, . . . , 3 and y=0, . . . , 3.

Referring to FIG. 7 a, in the case of vertical direction prediction, the first prediction value (pred1[x,y]) may be determined as values (722, 724, 726, 728) of upper reference pixels adjacent to the current block.

[Equation 1]

pred1[x,y]=p[x,−1](x=0, . . . , BlockWidth−1; y=0, . . . , BlockHeight−1)

Assuming that the left and upper side of the current block is positioned at [0,0], the first prediction value (pred1[x,y]) is determined using the pixel value of a pixel 722 positioned at [0,−1] with respect to pixels at the left boundary of the current block 710, the pixel value of a pixel 724 positioned at [−1,−1] with respect to pixels at the second column from the left side, the pixel value of a pixel 726 positioned at [2,−1] with respect to pixels at the third column from the left side, and the pixel value of a pixel 728 positioned at [3,−1] with respect to pixels at the right boundary.

The image encoding/decoding apparatus may use the first prediction value (pred1[x,y]) as the final prediction value (predS[x,y]).

[Equation 2]

predS[x,y]=pred[x,y](x=0, . . . , BlockWidth−1; y=0, . . . , BlockHeight−1)

Here, predS[x,y] refers to a final prediction value.

Referring to FIG. 7 b, in the case of horizontal direction prediction, the first prediction value (pred1[x,y]) may be determined as values of left reference pixels (732, 734, 736, 738) adjacent to the current block.

[Equation 3]

pred1[x,y]=p[−1,y](x=0, . . . , BlockWidth−1; y=0, . . . , BlockHeight−1)

The first prediction value (pred1[x,y]) is determined using the pixel value of a pixel 732 positioned at [−1,0] with respect to pixels at an upper boundary, the pixel value of a pixel 734 positioned at [−1,1] with respect to pixels at the second row from the upper side, the pixel value of a pixel 736 positioned at [−1,2] with respect to pixels at the third row from the upper side, and the pixel value of a pixel 738 positioned at [−1,3] with respect to the lower boundary. As in the vertical direction prediction, even in the horizontal direction prediction, the first prediction value (pred1[x,y]) may be used as the final prediction value (predS[x,y]).

FIG. 8 is a flowchart schematically illustrating an embodiment in which correction is performed on a first prediction value for a pixel in a current block to yield a final prediction value.

Referring to FIG. 8, the image encoding/decoding apparatus obtains a first prediction value (pred1[x,y]) through a scheme of utilizing the above-described reference pixel values (refer to FIGS. 7a and 7b ) in case it is determined in step S330 that correction is to be performed on the prediction value according to at least one of an intra prediction mode, bright signal, color difference signal information and block size (S810).

Then, the apparatus determines an initial correction value (d[x,y]) for the first prediction value (pred1[x,y]) of a prediction target pixel (S820). The initial correction value (d[x,y]) may be determined depending on the horizontal or vertical position of the prediction target pixel in the block. In other words, in the case of vertical direction prediction, the initial correction value (d[x,y]) may be determined according to the vertical-directional position of the prediction target pixel in the block, and in the case of horizontal direction prediction, the initial correction value (d[x,y]) may be determined according to the horizontal-directional position of the prediction target pixel in the block.

[Equation 4]

d[x,y]=d[y]=p[−1,y]−p[−1,−1] (in case of vertical direction prediction mode)

d[x,y]=d[x]=p[x,−1]−p[−1,−1] (in case of horizontal direction prediction mode)

In Equation 4, the differentials may be changed in terms of direction as in Equation 4′.

[Equation 4′]

d[x,y]=d[y]=p[−1,−1]−p[−1,y] (in case of vertical direction prediction mode)

d[x,y]=d[x]=p[−1,−1]−p[x,−1] (in case of horizontal direction prediction mode)

Next, a final correction value (delta[x,y]) is yielded based on the initial correction value (d[x,y]) (S830). At this time, computation efficiency may be elevated by producing the final correction value (delta[x,y]) through arithmetic right shift showing a relatively low computation complexity without performing division or multiplication operation with a high computation complexity. In other words, the final correction value (delta[x,y]) is obtained by arithmetically right-shifting a two's complementary integer representation for the initial correction value (d[x,y]) by a binary digit of M. At this time, the MSB (Most Significant Bit) of the arithmetically right-shifted final correction value (delta[x,y]) is the same as the MSB of the initial correction value (d[x,y]), and the final correction value (delta[x,y]) has the characteristic of being rounded in the direction of approaching negative infinity.

[Equation 5]

delta[x,y]=d[x,y]>>M

At this time, the binary digit M is preferably 1 or 2.

Finally, the first prediction value (pred1[x,y]) is added to the final correction value (delta[x,y]), thus yielding the final prediction value (predS[x,y]).

[Equation 6]

predS[x,y]=Clip1Y(pred1[x,y]+delta[x,y])

Here, Clip1 _(Y)(x)=Clip3(0, (1>>BitDepthY)−1, x),

${{Clip}\; 3\left( {x,y,z} \right)} = \left\{ {\begin{matrix} {x;} & {z < x} \\ {y;} & {z > y} \\ {z;} & {otherwise} \end{matrix},} \right.$

and BitDepthY denotes a bit depth of a brightness signal.

According to another embodiment of the present invention, a plurality of schemes may be used to generate the initial correction value (d[x,y]) and produce the final correction value (delta[x,y]) using the initial correction value (d[x,y]). First, according to a first embodiment, the final correction value (delta[x,y]) may be produced through an arithmetic right shift operation after performing conditional analysis on the initial correction value. According to the first embodiment, the following equation may be used to calculate a correction value so that the correction value is rounded to be close to 0.

[Equation 7]

delta[x,y]=(d[x,y]+(d[x,y]<0?2^(x):0))>>(x+1) (in case of vertical direction prediction mode)

delta[x,y]=(d[x,y]+(d[x,y]<0?2^(y):0))>>(y+1) (in case of horizontal direction prediction mode)

Further, according to a second embodiment, the following equation may be used to calculate a correction value so that the correction value is rounded to be an integer away from 0.

[Equation 8]

delta[x,y]=(d[x,y]+(d[x,y]<0?1+2^(x):1))>>(x+1) (in case of vertical direction prediction mode)

delta[x,y]=(d[x,y]+(d[x,y]<0?1+2^(y):1))>>(y+1) (in case of horizontal direction prediction mode)

Further, according to a third embodiment, the following equation may be used to calculate a correction value so that the correction value is rounded to an integer close to negative infinity. At this time, Equation 9 may apply only to a left boundary of a current block using the vertical direction prediction mode and an upper boundary of the current block using the horizontal direction prediction mode, and in such case, Equation 9 is the same as Equation 5 when M is 1.

[Equation 9]

delta[x,y]=d[x,y]>>(x+1) (in case of vertical direction prediction mode)

delta[x,y]=d[x,y]>>(y+1) (in case of horizontal direction prediction mode)

According to a fourth embodiment of the present invention, the initial correction value (d[x,y]) may be generated, and then, a Sign operation and an Abs operation may be used to calculate the final correction value (delta[x,y]) based on the initial correction value (d[x,y]). In such case, the final correction value (delta[x,y]) may be obtained by multiplying a value obtained by performing a Sign operation on the initial correction value by a value obtained by performing arithmetic right shift on an absolute value of the initial correction value. At this time, the final correction value may be calculated so that the obtained final prediction value is rounded to be an integer close to 0.

[Equation 10]

delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2^(x))>>(x+1))(in case of vertical direction prediction mode)

delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2^(y))>>(y+1))(in case of horizontal direction prediction mode)

Further, the final correction value according to a fifth embodiment based on the Sign operation and Abs operation may be obtained by multiplying a value obtained by performing a Sign operation on the initial correction value by a value obtained by performing an addition operation on an absolute value of the initial correction value and then performing an arithmetic right shift on a resultant value of the addition operation. At this time, the final correction value may be calculated so that the calculated final prediction value is rounded to be an integer away from 0.

[Equation 11]

delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2^(x))>>(x+1))(in case of vertical direction prediction mode)

delta[x,y]=Sign(d[x,y])*((Abs(d[x,y])+2^(y))>>(y+1))(in case of horizontal direction prediction mode)

Then, based on the final correction value obtained in the first to fifth embodiments, the first prediction value (pred1[x,y]) may be added to the final correction value (delta[x,y]) to thereby produce the final prediction value (predS[x,y]).

FIG. 9a is a view schematically illustrating an embodiment for producing a final prediction value by performing correction on a first prediction value when using a vertical mode.

Referring to FIG. 9 a, the image encoding/decoding apparatus determines a pixel value of an upper reference pixel of a current block 910 as a first prediction value (pred1[x,y]=p[x,−1]) when performing intra prediction through a vertical direction prediction mode.

Then, the apparatus performs correction targeting pixels 920 positioned at a left boundary of the current block 910. To perform correction on the first prediction value, an initial correction value is first determined. At this time, the initial correction value is determined depending on the vertical position of a prediction target pixel. That is, a difference between the value of a left reference pixel 940 corresponding to the prediction target pixel and the value of a left and upper cornered pixel 930 may become the initial correction value (d[x,y]=d[y]=p[—1,y]−p[−1,−1]). As described above, the initial correction value is present only when x=0 in case of the left boundary, and may be otherwise 0.

Next, a final correction value is calculated by arithmetic right-shifting a two's complementary integer representation for the initial correction value by a binary digit of 1 (delta[x,y]=d[x,y]>>1=(p[−1,y]−p[−1,−1])>>1).

Finally, the first pixel value is added to the final correction value, thus yielding a final prediction value (predS[x,y]=Clip1y(pred1[x,y]+delta[x,y]).

FIG. 9b is a view schematically illustrating an embodiment for producing a final prediction value by performing correction on a first prediction value when using a horizontal mode.

Referring to FIG. 9 b, the image encoding/decoding apparatus determines a pixel value of a left reference pixel of a current block 910 as a first prediction value (pred1[x,y]=p[−1,y]) in the case of performing intra prediction through a horizontal direction prediction mode.

Then, the apparatus performs correction on pixels 950 positioned at an upper boundary of the current block 910. An initial correction value is determined depending on a horizontal position of a prediction target pixel so as to perform correction on the first prediction value. That is, a difference between the value of an upper reference pixel 960 corresponding to the prediction target pixel and the value of a left and upper cornered pixel 930 may become the initial correction value (d[x,y]=d[x]=p[x,−1]−p[−1,−1]). As described above, the initial correction value is present only when y=0 in the case of the upper boundary, and may be otherwise 0.

Next, a final correction value may be calculated by arithmetic right shifting a two's complementary integer representation for the initial correction value by a binary digit of 1 (delta[x,y]=d[x,y]>>1=(p[x,−1]−p[−1,−1])>>1), and the first prediction value is added to the final correction value, thus yielding a final prediction value (predS[x,y]=Clip1y(pred1[x,y]+delta[x,y]).

FIG. 10 is a flowchart schematically illustrating a process of performing scaling in an image encoding/decoding method according to another embodiment of the present invention.

Referring to FIG. 10, the image encoding/decoding apparatus according to the other embodiment of the present invention may perform scaling to produce a motion vector of a prediction block when performing inter prediction or motion compensation on a current block. For this purpose, the image encoding/decoding apparatus determines whether a reference picture of the current block is the same as a reference picture of a reference block (S1010). At this time, the image encoding/decoding apparatus may determine whether reference picture indexes indicating reference pictures in a reference picture list are the same, but not only the sameness of the reference picture. Then, depending on a result of the determination, the image encoding/decoding apparatus determines whether to perform scaling a motion vector of the reference block (S1020). In case the reference pictures are the same, no scaling on the motion vector of the reference block may be done, but otherwise, scaling for the motion vector of the reference block is required. The scaled motion vector of the reference block serves as a basis for the motion vector of the current block and may be used for inter prediction of the current block.

Meanwhile, as inter prediction schemes applicable to the inter prediction through scaling, there may be an AMVP (Advanced Motion Vector Prediction) or a merge mode. In particular, in the merge mode, the scheme may be applicable to a temporal merge candidate inducing process in the merge mode and to a temporal motion vector inducing process and a spatial motion vector inducing process in the AMVP.

FIG. 11 a is a view illustrating a POC difference between a current picture and a current picture of a spatial reference block and a POC difference between the current picture and a reference picture of the current block.

Referring to FIG. 11 a, the reference block 1110 for inducing a spatial motion vector candidate among adjacent blocks of the current block 1100 may be at least one of a lowermost block adjacent to the left side of the current block 1100, a block adjacent to the lower side of the left and lowermost block, a left and upper cornered block of the current block, a right and upper cornered block of the current block and an upper and rightmost block adjacent to the current block. At this time, for the motion vector of the reference block 1110 to be able to be used for prediction of the current block 1100 without performing scaling, the reference picture 1140 of the reference block 1110 needs to be the same as the reference picture 1130 of the current block 1100, and the motion vector of the reference block 1110 may be otherwise subjected to scaling and may be then used for prediction of the current block 1100. That is, it may be determined whether tb indicating a difference between the reference picture 1130 of the current block and POC (Picture Order Count) of the current picture 1120 is the same as td indicating a POC difference between the current picture 1120 and the reference picture 1140 of the reference block 1110, and if the two are the same, no scaling is performed, and if the two are not the same, a scaling process may be done.

FIG. 11b is a view illustrating a POC difference between a reference picture of a co-located block and a co-located picture and a POC difference between a current picture and a reference picture of a current block.

Referring to FIG. 11 b, the image encoding/decoding apparatus may perform prediction of the current block 1100 based on a motion vector of a reference block associated with the co-located block 1150 at a location corresponding to the current block 1100 in an already reconstructed co-located picture 1160. That is, as a reference block for inducing a temporal motion vector or a temporal merge candidate, a block positioned in or outside the co-located block. The reference block may be determined according to a relative position of a right and lower cornered block of the co-located block or a right and lower block among four square blocks with respect of the center of the co-located block.

At this time, in using the motion vector of the temporal reference block, it is determined whether td indicating a POC difference between a reference picture 1170 referred to by the co-located block 1150 and the co-located picture 1160 is the same as tb indicating a POC difference between the reference picture 1130 referred to by the current block 1100 and the current picture 1120. A determination may be made so that if the two values are the same, no scaling is performed, and if the two values are not the same, a scaling process is performed.

FIG. 12 is a flowchart schematically illustrating an embodiment of a process of calculating a scaling factor for a motion vector based on POC differences between pictures.

As shown in FIG. 12, the image encoding/decoding apparatus obtains td and tb indicating POC differences between pictures so as to calculate a scaling factor (S1210). Here, the first value may refer to td, and the second value may refer to tb.

As described above, i) in the process of inducing a spatial motion vector (refer to FIG. 11a ), td denotes a difference between a POC of a current picture and a POC of a reference picture referred to by a spatially adjacent reference block, and tb denotes a difference between a POC of a current picture and a POC of a reference picture referred to by the current block. At this time, the reference picture of the current block and the reference picture of the reference block may have different prediction directions, and in such case, td and tb may be assigned with different signs. In some cases, td or tb may be adjusted to be included in a range from −128 to 127. At this time, if td or tb is smaller than −128, td or tb may be adjusted to −128, and if td or tb is larger than 127, td or tb may be adjusted to 127. If td or tb is included in a range between −128 and 127, no adjustment is made to td or tb.

[Equation 12]

td=Clip3(−128, 127, PicOrderCnt(currPic)−RefPicOrder(currPic, refIdxZ, ListZ))

tb=Clip3(−128, 127, PicOrderCnt(currPic)−RefPicOrder(currPic, reIdxLX, LX))

Here, currPic may denote a current picture. Further, X may have a value of 0 or 1. For example, if X=0, refIdxLX and LX may be refIdxL0 and L0, respectively, which means variables associated with L0 temporal motion information. Further, refIdxLX may denote an LX reference picture index indicating a reference picture in an LX reference picture list with reference pictures assigned therein. In case refIdxLX is 0, refIdxLX may denote the first reference picture in the LX reference picture list, and in case refIdxLX is −1, refIdxLX may represent no indication of a reference picture in the reference picture list. Further, Z may denote at least one of a lowest block adjacent to the left side which is a position of the reference block for inducing a spatial motion vector, a block adjacent to a lower side of the left and lowermost block, a left and upper cornered block of the current block, a right and upper cornered block of the current block, and an upper and rightmost block adjacent to the current block.

ii) in the process of inducing a temporal motion vector, and iii) in the process of inducing a temporal merge candidate (refer to FIG. 11b ), td may denote a difference between a POC of a co-located picture and a POC of a reference picture referred to by a co-located block, and tb may denote a difference between a POC of the current picture and a POC of a reference picture referred to by the current block. In such case, td or tb may be also adjusted to be included in a range between −128 and 127.

[Equation 13]

td=Clip3(−128, 127, PicOrderCnt(colPic)−RefPicOrder(currPic, refIdxCol, ListCol))

tb=Clip3(−128, 127, PicOrderCnt(currPic)−RefPicOrder(currPic, refIdxLX, LX))

Here, colPic may denote a co-located picture. Further, refIdxCol and ListCol may denote a reference picture index of the co-located block and a reference picture list.

Once td and tb are obtained, the image decoding apparatus may yield an offset value by arithmetic right-shifting a two's complementary integer representation for an absolute value of td by a binary digit of 1 (S1220). That is, the offset value may use a value proportional to the absolute value of td and may be calculated by performing an arithmetic right shift having a relatively low complexity without performing a high-complexity operation.

[Equation 14]

offset=Abs(td)>>1

At this time, Abs( )represents an absolute value function, and a value output from the corresponding function is an absolute value of an input value.

After performing the arithmetic right shift, the image encoding/decoding apparatus calculates an inverse-proportional value of td based on the offset value (S1230).

[Equation 15]

tx=(16384+offset)/td

After the inverse-proportional value (tx) of td is calculated, a scaling factor is calculated based on tb and the inverse-proportional value (tx) of td (S1240).

FIG. 13 is a block diagram schematically illustrating a configuration of calculating a final scaling factor based on tb and an inverse-proportional value of td. As shown in FIG. 13, the configuration 1300 for calculating the final scaling factor (ScaleFactor) may include a multiplier 1310, an addition operating unit 1320, an arithmetic shifting unit 1330, and a factor adjusting unit 1340.

Referring to FIG. 13, a first and second value obtaining unit 1302 obtains td and tb through the method described in step S1210. Then, an offset value calculating unit 1306 calculates an offset value through the method described in step S1220 based on td, and an inverse-proportional value calculating unit 1308 calculates an inverse-proportional value (tx) of td through the method described in the step S1230 based on the offset value.

The multiplier 1310 receives, as inputs, tb and the inverse-proportional value (tx) of td calculated in the inverse-proportional value calculating unit 1308 and performs multiplication. The addition operating unit 1320 may perform an addition operation based on the multiplication of tb and the inverse-proportional value (tx) of td. At this time, an operation of adding 32 may be performed. Then, the arithmetic shifting unit 1330 performs an arithmetic right shift on a two's complementary integer representation on a resultant value of the addition operation by a binary digit of 6. The operations performed thus far may be represented as follows:

[Equation 16]

ScaleFactor=(tb*tx+32)>>6

Then, the factor adjusting unit 1340 adjusts the scaling factor (ScaleFactor) to be included in a range between −4096 and 4095. Here, adjusting the scaling factor to be included in a specific range (e.g., between A and B) means clipping the factor to A if the scaling factor is smaller than A and to B if the scaling factor is larger than B.

After calculating the scaling factor, the image encoding/decoding apparatus may calculate a scaled motion vector (scaledMV). The scaled motion vector (scaledMV) may be calculated by multiplying the scaling factor (ScaleFactor) by the corresponding motion vector (which may mean a motion vector associated with at least one of spatial motion vector induction, temporal motion vector induction and temporal merge), performing a Sign operation on the resultant value of the multiplication, performing an addition operation and an arithmetic shift operation on an absolute value of the resultant value of the multiplication, and multiplying the Signed value by the resultant value of the addition and arithmetic shift operation.

[Equation 17]

scaled MV=Sign(ScaleFactor*mv)*((Abs(ScaleFactor*mv)+127)>>8)

Here, Sign( )outputs information on the sign of a specific value (e.g., Sign(−1) outputs ‘-’), and my denotes a motion vector before scaling. At this time, scaling may be performed on each of an x component and a y component of the motion vector.

The image encoding/decoding apparatus may generate a prediction block of a current block using a motion vector scaled as above.

According to another embodiment of the present invention, the above-described scaling factor calculating scheme may be also used in a process of calculating an in-implicit-weighted-prediction scaling factor. The image encoding/decoding apparatus obtains td and tb that denote POC differences between pictures in order to calculate a scaling factor upon performing the implicit weighted prediction.

td may denote a POC of a reference picture referred to by a current picture among reference pictures in a reference picture list 1 and a POC of a reference picture referred to by a current picture among reference pictures in a reference picture list 0, and tb may denote a difference between a POC of a current picture and a POC of a reference picture referred to by the current picture among rep s in the reference picture list 0. At this time, td or tb may be adjusted to be included in a range between −128 and 127. At this time, if td or tb is smaller than −128, td or tb may be adjusted to −128, and if td or tb is larger than 127, td or tb may be adjusted to 127. If td or tb is included in a range between −128 and 127, no adjustment is made to td or tb.

[Equation 18]

td=Clip3(−128, 127, PicOrderCnt(currPic, refldxL1, L1)−Ref PicOrder(currPic, refIdxL0, L0)) tb=Clip3(-128, 127, PicOrderCnt(currPic)−RefPicOrder(currPic, refIdxL0, LO))

Then, the image decoding apparatus may calculate an offset value by performing an arithmetic right shift on a two's complementary integer representation for an absolute of td by a binary digit of 1.

After performing the arithmetic right shift, the image encoding/decoding apparatus calculates an inverse-proportional value (tx=(16384+offset)/td) of td based on the offset value, calculates an inverse-proportional value (tx) of td, and calculates a scaling factor (ScaleFactor=(tb*tx+32)>>6) based on tb and the inverse-proportional value (tx) of td.

In particular, in calculating the in-implicit-weighted-prediction scaling factor, the scaling factor (ScaleFactor) may be adjusted to be included in a range between −1024 and 1023. At this time, in case the distance between images increases, scaling on a weighting factor, which is performed using the distance between images, may not be properly done, and thus, incorrect implicit weighted prediction is performed, thus causing a deterioration of the encoding efficiency. Accordingly, rather than being included in a range between −1024 and 1023, the scaling factor may be adjusted to be included in a range between −4096 and 4065.

At this time, by using the weighting factor, a weighting value for a reference picture in the reference picture list 0 may be determined as 64-(ScaleFactor>>2), and a weighting value for a reference picture in the reference picture list 1 may be determined as ScaleFactor>>2.

Although in the embodiments the methods are described based on flowcharts with a series of steps or blocks, the present invention is not limited to the order, and some steps may be performed simultaneously with or in a different sequence from other steps. Further, it may be understood by those skilled in the art that other steps may be non-exclusively included in the steps of the flowcharts or one or more steps may be removed from the flowcharts without affecting the scope of the present invention.

The above-described embodiments include various aspects of examples. Although all possible combinations of the various aspects of examples may be not described herein, it will be understood by those skilled in the art that such combinations are possible. Accordingly, the present invention includes all other modifications, variations, or changes that may be made to the appending claims. 

1. A video decoding method comprising: generating a prediction block by performing intra prediction for a current block; and reconstructing a picture based on a reconstructed residual block and the prediction block, wherein a final prediction value of a prediction target pixel of the prediction block is generated based on a first prediction value of the prediction target pixel and a final correction value calculated by performing an arithmetic right shift on an initial correction value of the prediction target pixel by a binary digit of
 1. 2. The video decoding method of claim 1, wherein whether to correct an intra prediction value is determined depending on encoding information on the current block and a position of the prediction target pixel in the prediction block and the final prediction value of the prediction target pixel is generated based on a result of the determination.
 3. The video decoding method of claim 2, wherein the encoding information comprises at least one of an intra prediction mode, luma signal information, chroma signal information and a block size of the current block.
 4. The video decoding method of claim 2, wherein a pixel on a left boundary of the current block is corrected when an intra prediction mode of the current block is a vertical prediction mode.
 5. A video encoding method comprising: generating a prediction block by performing intra prediction for a current block; and reconstructing a picture based on a reconstructed residual block and the prediction block, wherein a final prediction value of a prediction target pixel of the prediction block is generated based on a first prediction value of the prediction target pixel and a final correction value calculated by performing an arithmetic right shift on an initial correction value of the prediction target pixel by a binary digit of
 1. 6. The video encoding method of claim 5, wherein whether to correct an intra prediction value is determined depending on encoding information on the current block and a position of the prediction target pixel in the prediction block and the final prediction value of the prediction target pixel is generated based on a result of the determination.
 7. The video encoding method of claim 6, wherein the encoding information comprises at least one of an intra prediction mode, luma signal information, chroma signal information and a block size of the current block.
 8. The video encoding method of claim 6, wherein a pixel on a left boundary of the current block is corrected when an intra prediction mode of the current block is a vertical prediction mode.
 9. A non-transitory computer-readable medium storing a bitstream generated by the video encoding method of claim
 5. 10. A non-transitory computer-readable medium storing a bitstream, the bitstream comprising: residual block information which is used for generating a reconstructed residual block; wherein a prediction block is generated by performing intra prediction for a current block, a picture is reconstructed based on the reconstructed residual block and the prediction block, and a final prediction value of a prediction target pixel of the prediction block is generated based on a first prediction value of the prediction target pixel and a final correction value calculated by performing an arithmetic right shift on an initial correction value of the prediction target pixel by a binary digit of
 1. 11. The non-transitory computer-readable medium of claim 10, wherein whether to correct an intra prediction value is determined depending on encoding information on the current block and a position of the prediction target pixel in the prediction block and the final prediction value of the prediction target pixel is generated based on a result of the determination.
 12. The non-transitory computer-readable medium of claim 11, wherein the encoding information comprises at least one of an intra prediction mode, luma signal information, chroma signal information and a block size of the current block.
 13. The non-transitory computer-readable medium of claim 11, wherein a pixel on a left boundary of the current block is corrected when an intra prediction mode of the current block is a vertical prediction mode. 